package org.test.java;

import static org.test.java.ShuaTa.httpRequestWithLogFile;
import static org.test.java.ShuaTa.print;
import static org.test.java.ShuaTa.logFile;

import java.io.IOException;
import java.util.Map;
import java.util.Properties;


public class Shop {

	private String _sid;
	Properties props;
	
	public Shop(String _sid, Properties props) {
		this._sid = _sid;
		this.props = props;
		if (props.containsKey("shuaTaLogFile")) {
			logFile = props.getProperty("shuaTaLogFile");
		}
	}
	
	
	public void buyCard(int num) throws IOException{
		Map map = httpRequestWithLogFile(_sid, "user.php", "GetUserinfo", "", logFile);
		Map data = (Map) map.get("data");
		System.out.println(data.get("NickName").toString());
		for(int i = 0 ; i< num;i++){
			httpRequestWithLogFile(_sid, "shop.php", "Buy", "GoodsId=1", logFile);
		}
		System.out.println("购买完成。");
	}
}
